const nextRelationUpdate = (conData, pIds, nextRelationChildren) => {
  if (!pIds.length) return
  let parentRelationData = conData.children.find(item => item.id == pIds[0])
  if (!parentRelationData) {
    parentRelationData = {id: pIds[0], model: "relationCon", children: []}
    conData.children.push(parentRelationData)
  }
  if (pIds.length == 1) parentRelationData.children = nextRelationChildren
  pIds.shift()
  nextRelationUpdate(parentRelationData, pIds, nextRelationChildren)
}


let conData = {"id": "000", "model": "relationCon", "children": []}

let nextRelationChildren = [
  'aaa', 'bbb'
]
let idList = ['111', '222']
nextRelationUpdate(conData, idList, nextRelationChildren)
console.log(JSON.stringify(conData))
